﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
		<style>
			td{font-size:10pt;cursor:default}
		</style>
		<style media="print">
			.Noprint { DISPLAY: none }
		</style>
		<title>列印預覽</title>
		<script language="javascript">
		var DataReading=false		//是否正在讀取資料
		function ButtonStyleSet(Style,Element)
		{
			if(Element.getAttribute("Enabled")!=null)
			{
				if(Element.getAttribute("Enabled")=="False")
				return false
			}
			switch(Style)
			{
			case "3D":
				Element.style.borderRight="buttonshadow 1px solid";
				Element.style.borderTop="buttonhighlight 1px solid";
				Element.style.borderLeft="buttonhighlight 1px solid";
				Element.style.borderBottom="buttonshadow 1px solid";
				break;
			case "Flat":
				Element.style.borderLeft="0px";
				Element.style.borderBottom="0px";
				Element.style.borderRight="0px";
				Element.style.borderTop="0px";
				break;
			case "Cancave":
				Element.style.borderLeft="buttonshadow 1px solid";
				Element.style.borderBottom="buttonhighlight 1px solid";
				Element.style.borderRight="buttonhighlight 1px solid";
				Element.style.borderTop="buttonshadow 1px solid";
				break;
			}
		}
		function DisableBtn(btn,disable)
		{
			var temp;
			if(btn=="上一頁")
			{
				temp=document.all("PageNoTable").rows[0].cells[1];
			}
			if(btn=="下一頁")
				temp=document.all("PageNoTable").rows[0].cells[2];
			if(disable)
			{
				temp.style.color="InactiveCaptionText";
				temp.setAttribute("Enabled","False");
			}
			else
			{
				temp.style.color="black";
				temp.setAttribute("Enabled","true");
			}
		}
		function IsEnabled(element)
		{
			if(element.getAttribute("Enabled")!=null)
			{
				if(element.getAttribute("Enabled")=="False")
					return false;
			}
			return true;
		}
		function PreviewPrevious()
		{
			if(!IsEnabled(window.event.srcElement))
				return;
			i=parseInt(document.all("curPage").innerText)
			if(i<=1)
				return;
			if(DataReading)
				return;
			DataReading=true;
			window.opener.PreviewPreviousPage();
			i--;
			if(i==1)
			{
				DisableBtn("上一頁",true)
			}
			DisableBtn("下一頁",false);
			document.all("curPage").innerText=i.toString();
		}
		function PreviewNext()
		{
			if(!IsEnabled(window.event.srcElement))
				return;
			if(DataReading)
				return;
			ShowWaitInfo(true);
			DataReading=true;
			i=parseInt(document.all("curPage").innerText)
			j=parseInt(document.all("totalPage").innerText)
			if(i==j)
				return;
			window.opener.PreviewNextPage();
			i++;
			document.all("curPage").innerText=i.toString();
			if(i==j)
			{
				DisableBtn("下一頁",true);
			}
			if(i>1)
				DisableBtn("上一頁",false)
		}
		function PreviewFirst()
		{
			SetPreviewContext(window.opener.GetReportContext(1));
			document.all("curPage").innerText=window.opener.currentPrintPage;
			document.all("totalPage").innerText=window.opener.totalPrintPage;
			
			if(window.opener.IsPrintCurrentPage() || window.opener.currentPrintPage==window.opener.totalPrintPage)
			{
				DisableBtn("上一頁",true);
				DisableBtn("下一頁",true);
			}
		}
		function SetPreviewContext(ReportContext)
		{
			document.all("PreviewArea").innerHTML=ReportContext;
			DataReading=false;
		}
		function maxWin()
		{
			try
			{
				var b = top.screenLeft == 0;
				var b = b && top.screen.availHeight - top.screenTop - top.body.offsetHeight - 20 == 0;
				if(!b)
				{
					var str  = '<object id=meizzMax classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">'
					str += '<param name="Command" value="Maximize"></object>';
					if(typeof(meizzMax)!="object") document.body.insertAdjacentHTML("beforeEnd", str);
					{
						document.getElementById("meizzMax").Click();
					}
				}
			}catch(e){}
		}
		function ShowWaitInfo(show)
		{
			if(show)
			{
				x=(window.document.body.offsetWidth-200)/2;
				y=(document.body.offsetHeight-40)/2;
				document.all("WaitInfo").style.left=x;
				document.all("WaitInfo").style.top=y;
				document.all("WaitInfo").style.display="inline";
			}
			else
			{
				document.all("WaitInfo").style.display="none";
			}
		}
		function Preview()
		{
			Printer.ExecWB(7,1);
		}
		</script>
	</head>
	<body topmargin="0" rightmargin="0" leftmargin="0" bottommargin="0" onload="PreviewFirst();maxWin()">
	<OBJECT id="Printer" height="0" width="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"
			 >
		</OBJECT>
		<table class="NoPrint" height="30" align="center" width="100%" bgcolor="#F7F3EF" style="BORDER-RIGHT: #f7f3ef thin outset; BORDER-TOP: #ffffff thin solid; BORDER-LEFT: #ffffff thin solid; BORDER-BOTTOM: #f7f3ef thin outset; BORDER-COLLAPSE: collapse">
			<tr>
				<td width=35%>
					<table width=100% height=100% id="PageNoTable" onselectstart="return false;">
						<tr>
							<td  align=center onclick="top.window.close()" onmouseover="ButtonStyleSet('3D',this)" onmouseout="ButtonStyleSet('Flat',this)" onmousedown="ButtonStyleSet('Cancave',this)" onmouseup="ButtonStyleSet('Flat',this)">關　閉</td>
							<td align=center onclick="PreviewPrevious()" onmouseover="ButtonStyleSet('3D',this)" onmouseout="ButtonStyleSet('Flat',this)" onmousedown="ButtonStyleSet('Cancave',this)" onmouseup="ButtonStyleSet('Flat',this)">上一頁</td>
							<td align=center onclick="PreviewNext()" onmouseover="ButtonStyleSet('3D',this)" onmouseout="ButtonStyleSet('Flat',this)" onmousedown="ButtonStyleSet('Cancave',this)" onmouseup="ButtonStyleSet('Flat',this)">下一頁</td>
							<td align=center onclick="Preview()" onmouseover="ButtonStyleSet('3D',this)" onmouseout="ButtonStyleSet('Flat',this)" onmousedown="ButtonStyleSet('Cancave',this)" onmouseup="ButtonStyleSet('Flat',this)">實際列印效果</td>
						</tr>
					</table>
				</td>
				<td width=65%>
					&nbsp;&nbsp;頁碼&nbsp;<span id="curPage"></span>/<span id="totalPage"></span>
				</td>
			</tr>
		</table>
		<br>
		<div id="PreviewArea" name="PreviewArea"></div>
		<table bgcolor="#F7F3EF" align=center style="BORDER-RIGHT: buttonface thin outset; BORDER-TOP: white 1px solid; BORDER-LEFT: white 1px solid; BORDER-BOTTOM: buttonface thin outset;position:absolute;display:none" width=200 height=40 id="WaitInfo">
			<tr>
				<td align=center><font size=2>正在獲取預覽...</font></td>
			</tr>
		</table>
	</body>
</html>
